<%@ include file="/pages/taglibs.jsp"%>
<head>
	<title><bean:message key="estatistica.title" /></title>
	<html:javascript formName="pontosParadaForm" dynamicJavascript="true" staticJavascript="false"/>
</head>
<body>
	<html:form action="/estatistica" method="post" onsubmit="return validatePontosParadaForm(this);">
		<html:hidden property="method" value="list" />	
		<fieldset id="fieldset-mv">
			<legend><bean:message key="common.parametroPesquisa" />:</legend>
			<div>
				<div class="campoSelecao">
					<label for="veiculos"><bean:message key="common.veiculos" />:</label><br />
					<html:select property="veiculoId" styleId="veiculos">
						<html:option value=""><bean:message key="common.selecione.veiculo" /></html:option>
						<c:forEach items="${user.veiculos}" var="veiculo">
							<html:option value="${veiculo.ID}">${veiculo.DESC}</html:option>
						</c:forEach>
					</html:select>
				</div>
				<div class="campoTexto">
					<label for="dataInicial"><bean:message key="common.datainicial" />:</label><br />
					<tags:dateInput id="dataInicial" defaultDate="${pontosParadaForm.map.dataInicial}" buttonImage="images/buttons/calendario.gif" />
				</div>
				<div class="campoTexto">
					<label for="horaInicial"><bean:message key="common.horainicial" />:</label><br />
					<tags:hourinput id="horaInicial" value="${pontosParadaForm.map.horaInicial}" />
				</div>
				<div class="campoTexto">
					<label for="dataFinal"><bean:message key="common.datafinal" />:</label><br />
					<tags:dateInput id="dataFinal" defaultDate="${pontosParadaForm.map.dataFinal}" buttonImage="images/buttons/calendario.gif" />
				</div>
				<div class="campoTexto">
					<label for="horaFinal"><bean:message key="common.horafinal" />:</label><br />
					<tags:hourinput id="horaFinal" value="${pontosParadaForm.map.horaFinal}" />
				</div>
			</div>
		</fieldset>
		<div class="barraBotoes">
			<button type="submit" name="consultar" id="consultar"><bean:message key="command.search" /></button>
		</div>
		<br clear="all" />	
		
	</html:form>


	<display:table id="row" name="dias" class="tabelaEstatisticasVeiculo" varTotals="totals">	
		<display:column titleKey="estatistica.dia" headerClass="coluna1" class="coluna1">
			${row.dia} 
			<c:if test="${idioma eq 'pt'}">
			${row.diaSemana} 
			</c:if>
		</display:column>
		<display:column titleKey="estatistica.km" property="distancia" 
			total="true" format="{0,number,#,###.00}" headerClass="coluna2" class="coluna2" />
		<display:column titleKey="estatistica.velocidadeMedia" property="velMedia" 
			total="true" format="{0,number,#,###.00}" headerClass="coluna3" class="coluna3" />
		<display:column titleKey="estatistica.velocidadeMax" property="velMaxima" 
			total="true" format="{0,number,#,###.00}" headerClass="coluna4" class="coluna4" />
		<display:column titleKey="estatistica.tempoMovimento" total="true" property="tempoMovimento"
			headerClass="coluna5" class="coluna5" decorator="br.com.srv.util.HoraTableDecorator" />
		<display:column titleKey="estatistica.tempoParado" total="true" property="tempoParado"
			headerClass="coluna6" class="coluna6" decorator="br.com.srv.util.HoraTableDecorator" />
		<display:footer>
			<tr class="footer">
				<td colspan="4"><bean:message key="common.total"/>:</td>
				<td align="center">
					${functions:parseHour(totals.column5)}
				</td>
				<td align="center">
					${functions:parseHour(totals.column6)}
				</td>
			<tr>
		</display:footer>
	</display:table>

</body>